<template>
  <div id="msgDetail">
    <div class="center">
      <div class="msgCon">
        <span class="msgtitle"><router-link tag="span" :to="{name: 'msglist'}">消息中心></router-link><span>消息详情</span></span>
      </div>
      <div class="newDetail">
        <div class="yonghu">亲爱的用户{{to_name}}：</div>
        <div class="newsCon">
          {{content}}
        </div>
        <div class="newsName">{{from_name}}</div>
        <div class="time">{{created_at}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'msgDetail',
  data () {
    return {
      // true代表看过，false代表没看过
      title: '',
      from_name: '',
      to_name: '',
      content: '',
      created_at: ''
    };
  },
  mounted () {
    this.getDetail();
  },
  methods: {
    getDetail: function () {
      let $id = this.$route.params.id;
      console.log($id);
      this.axios.get('crm/message/' + $id).then(
        ({data}) => {
          if (data.code !== 200) {
            return;
          }
          console.log(data);
          let $data = data.data;
          this.title = $data.title ? $data.title : '';
          this.from_name = $data.from_name ? $data.from_name : '';
          this.to_name = $data.to_name ? $data.to_name : '';
          this.content = $data.content ? $data.content : '';
          this.created_at = $data.created_at ? $data.created_at : '';
        }
      );
    }
  }
};
</script>

<style lang="scss">
  #msgDetail {
    min-width: 1200px;
    $sbcolor: #10A57D;
    $gray: #DFDFDF;
    .center {
      width: 1200px;
      margin: 0 auto;
      .msgCon {
        height: 82px;
        padding-bottom: 10px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        margin-bottom: 48px;
        border-bottom: 1px solid $gray;
        .msgtitle {
          padding-left: 16px;
          font-size:18px;
          font-family:MicrosoftYaHei;
          font-weight:400;
          color:rgba(51,51,51,1);
          border-left: 7px solid $sbcolor;
          span:first-child {
            color: $sbcolor;
            cursor: pointer;
          }
        }
      }
      .newDetail {
        margin-bottom: 50px;
        padding: 92px 100px;
        border:1px solid rgba(223,223,223,1);
        box-shadow:0px 1px 9px 1px rgba(0,0,0,0.1);
        font-size:16px;
        color:rgba(51,51,51,1);
        .yonghu {
          margin-bottom: 20px;
        }
        .newsName {
          text-align: right;
          margin-top: 60px;
          margin-bottom: 30px;
        }
        .newsCon {
          text-indent: 2em;
        }
        .time {
          text-align: right;
        }
      }
    }
  }
</style>
